package hu.bme.mit.inf.expendables.entities;
	
import javax.persistence.*;
import hu.bme.mit.inf.expendables.entities.*;
import java.util.List;
import java.util.ArrayList;


@Entity
@Table(name="T_USER")
@NamedQueries(
	{
	@NamedQuery(name=User.GET_USER,query="SELECT u FROM User u WHERE u.userId = :userId"),
	@NamedQuery(name=User.DELETE_USER,query="DELETE FROM User u WHERE u.userId = :userId"),
	@NamedQuery(name=User.GET_USER_BY_NAME,query="SELECT u FROM User u WHERE u.username = :userName"),
	@NamedQuery(name=User.UPDATE_STATUS,query="UPDATE User u SET u.isLoggedIn = :status WHERE u.userId = :userId")
	})
public class User {
	                        	
	public static final String GET_USER = "GetUser";
	public static final String DELETE_USER = "DeleteUser";
	public static final String GET_USER_BY_NAME = "GetUserByName";
	public static final String UPDATE_STATUS = "UpdateStatus";

	//Attributes
	@Column(unique=true)
	private String username;
	
	private String password;
	
	private String email;
	
	@Id
	@GeneratedValue
	@Column(name="USER_ID")
	private long userId;
	
	private Boolean isLoggedIn;
	
	@Temporal(TemporalType.DATE)
	private java.util.Date birthDate;
	

	//Reference to Account
	@OneToOne
	@JoinColumn(name = "ACCOUNT_ID")
	private Account account;
	


	//Getters and Setters
	public String getUsername(){
		return username;
	}
	
	public void setUsername(String username){
		this.username = username;
	}
	
	public String getPassword(){
		return password;
	}
	
	public void setPassword(String password){
		this.password = password;
	}
	
	public String getEmail(){
		return email;
	}
	
	public void setEmail(String email){
		this.email = email;
	}
	
	public long getUserId(){
		return userId;
	}
	
	public void setUserId(long userId){
		this.userId = userId;
	}
	
	public Boolean getIsLoggedIn(){
		return isLoggedIn;
	}
	
	public void setIsLoggedIn(Boolean isLoggedIn){
		this.isLoggedIn = isLoggedIn;
	}
	
	public java.util.Date getBirthDate(){
		return birthDate;
	}
	
	public void setBirthDate(java.util.Date birthDate){
		this.birthDate = birthDate;
	}
	

	public Account getAccount(){
		return account;
	}
	
	public void setAccount(Account account){
		this.account = account;
	}
		
}